{{ define "front/pass/register_step1.html" }}
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="author" content="order by dede58.com" />
    <title>用户注册</title>
    <link rel="stylesheet" href="/static/front/css/pass.css" />
    <script src="/static/front/js/jquery-1.10.1.js"></script>
    <script src="/static/front/js/pass.js"></script>
  </head>

  <body class="register_page">
    <div class="regist">
      <div class="regist_center">
        <div class="logo">
          <img src="/static/front/image/logo_top.png" alt="nest小米" />
        </div>
        <div class="regist_top">
          <h2>注册小米账户</h2>
        </div>
        <div class="regist_main center">
          <div class="error"></div>
          <input type="hidden" name="captchaId" id="captchaId" />
          <input
            class="form_input"
            type="text"
            name="phone"
            id="phone"
            placeholder="请填写正确的手机号"
          />

          <div class="yzm">
            <input
              type="text"
              id="verifyCode"
              name="verifyCode"
              placeholder="请输入图形验证码"
            />
            <img id="captchaImg" src="" />
          </div>

          <div class="regist_submit">
            <button class="submit" id="registerButton">立即注册</button>
          </div>
          <br />
          <br />
          <div class="privacy_box">
            <div class="msg">
              <label class="n_checked now select-privacy">
                <input type="checkbox" checked="true" />
                注册帐号即表示您同意并愿意遵守Gin仿小米
                <a
                  href="https://static.account.xiaomi.com/html/agreement/account/cn.html"
                  class="inspect_link"
                  title="用户协议"
                  target="_blank"
                  >用户协议</a
                >和<a
                  href="https://www.mi.com/about/privacy/"
                  class="inspect_link privacy_link"
                  title=" 隐私政策 "
                  target="_blank"
                >
                  隐私政策
                </a>
              </label>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script>
      $(function () {
        //发送验证码
        $('#registerButton').click(function () {
          //验证验证码是否正确
          var phone = $('#phone').val()
          var verifyCode = $('#verifyCode').val()
          var captchaId = $('#captchaId').val()
          $('.error').html('')

          var reg = /^[\d]{11}$/
          if (!reg.test(phone)) {
            $('.error').html('Error：手机号输入错误')
            return false
          }
          if (verifyCode.length < 2) {
            $('.error').html('Error：图形验证码长度不合法')
            return false
          }

          $.get(
            '/pass/sendCode',
            { phone: phone, verifyCode: verifyCode, captchaId: captchaId },
            function (response) {
              console.log(response)
            }
          )
        })
      })
    </script>
  </body>
</html>

{{ end }}
